Azure python sdk url summary upstream#20563
Conversation
bdrodes
commented
Sep 30, 2025
- Added MaD sinks for URLs in the azure SDK, labeled as 'ssrf'
- Updated HTTP request clients to use 'ssrf' MaD
There was a problem hiding this comment.
Pull Request Overview
This PR adds Server-Side Request Forgery (SSRF) modeling for the Azure Python SDK by introducing MaD (Models as Data) sinks and updating HTTP request clients to recognize SSRF vulnerabilities. This enables CodeQL to detect when user input can control URLs passed to Azure SDK methods.
- Added SSRF sink modeling framework for MaD-based HTTP requests
- Created comprehensive Azure SDK models for KeyVault and Storage services
- Added test coverage for Azure client SSRF scenarios
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/ql/lib/semmle/python/frameworks/SSRFSink.qll | New framework for handling SSRF sinks through MaD models |
| python/ql/lib/semmle/python/frameworks/Azure.Storage.model.yml | MaD definitions for Azure Storage SDK SSRF sinks |
| python/ql/lib/semmle/python/frameworks/Azure.Keyvault.model.yml | MaD definitions for Azure KeyVault SDK SSRF sinks |
| python/ql/lib/semmle/python/Frameworks.qll | Import statement for new SSRFSink framework |
| python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/test_azure_client.py | Test cases for Azure SDK SSRF detection |
| python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/PartialServerSideRequestForgery.expected | Expected results for partial SSRF tests |
| python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/FullServerSideRequestForgery.expected | Expected results for full SSRF tests |
| python/ql/lib/change-notes/released/2025-09-30-azure_ssrf_models | Release notes for the changes |
python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/test_azure_client.py
Outdated
Show resolved
Hide resolved
python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/test_azure_client.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…orgery/test_azure_client.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…orgery/test_azure_client.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
owen-mc
left a comment
There was a problem hiding this comment.
I'm not familiar with the python library in general, but I can review the use of models-as-data.
| or | ||
| this.getArgByName(_) = urlArg | ||
| ) and | ||
| urlArg = ModelOutput::getASinkNode("ssrf").asSink() |
There was a problem hiding this comment.
- Some tests are failing because we do validation on sink kinds and "ssrf" isn't on the list. Please use "request-forgery", which is what all the other languages use. (New sink kinds can of course be added, but if there is an existing one then that should be used first, to keep the different language libraries consistent.)
- In Python: MaD barriers #21004 we switched to using a slightly different syntax (which matches the static languages). You'll have to rebase on
mainfor this to work.
| urlArg = ModelOutput::getASinkNode("ssrf").asSink() | |
| ModelOutput::sinkNode(urlArg, "request-forgery") |
|
Looking at the other test failures (which aren't related to validation of sink kinds):
|
…t cases expected results, off by one line. Changed to using ModelOutput::sinkNode.
Fixed. |